package com.ruoyi.common.core.domain.query;

import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.ruoyi.common.core.domain.CustomDataConfig;
import lombok.Data;

@Data
public class CustomDataConfigQuery extends CustomDataConfig {
    private String id;
    private String type; //系统类型
    private String dataName;  //数据名称
    private String title;  //数据标题
    private String sql;  //sql
    private String prop;  //列名称
    private String db_src;  //数据库来源
    private String attr;  //列对应的属性
    private JSONObject meta;

    public JSONObject getMeta() {
        if (meta != null) {
            return meta;
        }
        if (StrUtil.isNotBlank(attr)) {
            meta = JSON.parseObject(attr);
        } else {
            meta = new JSONObject();
        }
        return meta;
    }

}
